Fix altitude in lowrance usr format.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 4 Jul 2005 17:55:59 +0000 (17:55 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 4 Jul 2005 17:55:59 +0000 (17:55 +0000)
gpsbabel/defs.h
gpsbabel/lowranceusr.c

index afdb0c510e506fe7e78cb84a98111170824ef91f..c7dfef4e4a835ffdf5bc9276a5f5070943e23f34 100644 (file)
@@ -36,6 +36,9 @@
 #  define M_PI 3.14159265358979323846
 #endif
 
+#define FEET_TO_METERS(feetsies) ((feetsies) * 0.3048)
+#define METERS_TO_FEET(meetsies) ((meetsies) * 3.2808399)
+
 /*
  * Snprintf is in SUS (so it's in most UNIX-like substance) and it's in 
  * C99 (albeit with slightly different semantics) but it isn't in C89.   
index 9169b46bf0bdf6651efc7bbdb457a7b5fdd017ae..450f001b611dbf7e30146d79c15be1c570adeeae 100644 (file)
@@ -297,7 +297,7 @@ lowranceusr_parse_waypt(waypoint *wpt_tmp)
        lowranceusr_fread(&buff[0], 4, 1, file_in);
        wpt_tmp->longitude = lon_mm_to_deg(le_read32(&buff[0]));
        lowranceusr_fread(&buff[0], 4, 1, file_in);
-       wpt_tmp->altitude = le_read32(&buff[0]);
+       wpt_tmp->altitude = FEET_TO_METERS(le_read32(&buff[0]));
        lowranceusr_fread(&buff[0], 4, 1, file_in);
        TextLen = buff[0];
        lowranceusr_fread(&buff[0], TextLen, 1, file_in);
@@ -591,7 +591,7 @@ lowranceusr_waypt_disp(const waypoint *wpt)
        short int WayptType;
        char *name;
        char *comment;
-       int alt = wpt->altitude;
+       int alt = METERS_TO_FEET(wpt->altitude);
        time_t base_time_secs = mktime(&base_time);
 
        Lat = lat_deg_to_mm(wpt->latitude);